package com.copm.ifm.servers.sys.controller;

import com.copm.ifm.base.api.pojo.PageDTO;
import com.copm.ifm.base.api.pojo.PageVO;
import com.copm.ifm.base.basic.ServiceResponse;
import com.copm.ifm.base.service.base.BaseController;
import com.copm.ifm.servers.sys.client.SysSupplierClient;
import com.copm.ifm.servers.sys.dto.SysSupplierPageDTO;
import com.copm.ifm.servers.sys.dto.SysSupplierUpdateDTO;
import com.copm.ifm.servers.sys.service.SysSupplierService;
import com.copm.ifm.servers.sys.vo.SysSupplierPageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author msp
 * @date 2020/12/31
 */
@Api(tags = "供应商推荐管理/sys-supplier")
@RestController
@RequestMapping("/sys-supplier")
public class SysSupplierController extends BaseController implements SysSupplierClient {

    @Resource
    private SysSupplierService sysSupplierService;

    @Override
    @ApiOperation("查询分页")
    @PostMapping("/page")
    public ServiceResponse<PageVO<SysSupplierPageVO>> page(
                                    @ApiParam("分页查询参数实体") @RequestBody PageDTO<SysSupplierPageDTO> pageDTO) {
        PageVO<SysSupplierPageVO> pageVO = sysSupplierService.selectForPage(pageDTO);
        return success(pageVO);
    }

    @ApiOperation("更新")
    @PutMapping
    public ServiceResponse<?> update(
            @ApiParam("修改参数实体") @RequestBody SysSupplierUpdateDTO updateDTO) {
        sysSupplierService.update(updateDTO);
        return success();
    }
}
